#encoding=utf-8
#encoding=gb18030
"""封装driver类,每次只要调用功能get_driver（）即可返回driver
"""
import time
from appium import webdriver
from setLog import Logger

mylogger = Logger(logger='Driver').get_log()
class AppiumTest():



    def __init__(self):

        desired_caps = {
            'platformName': 'Android',
            'deviceName': 'CLB0218424000058',  # 华为Note8 8DF6R16729019152  #华为P20  CLB0218424000058
            'platformVersion': '8.1.0',
            'appPackage': 'com.hexin.zhanghu',
            'appActivity': 'com.hexin.zhanghu.main.WelcomeActivity',
            # 'noReset': 'True',  # 每次不用初始化
            'unicodeKeyboard': 'True', #使用unicode编码方式发送字符串，若出现乱码则加  #encoding=gb18030
            'resetKeyboard':'True'   #隐藏键盘，若运行手机后键盘不出现，则去设置中输入法设置选项中切换
        }
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
        #隐式等待
        # self.driver.implicitly_wait(30)
        time.sleep(1)

        mylogger.info("启动成功")
        print('启动成功')
        # return self.driver
    def get_driver(self):
        return self.driver
